package operation;

import book.BookList;

import java.util.Scanner;

public class ReturnOperation implements IOPeration{
    @Override
    public void work(BookList bookList) {
        System.out.println("归还图书。。。");
        System.out.println("请输入你要还的书的名称：");
        Scanner scanner = new Scanner(System.in);
        String bookName = scanner.next();
        int flag = bookList.returnBook(bookName);
        if (flag == 1) {
            System.out.println("归还成功！");
        } else if (flag == -1){
            System.out.println("该书无需归还");
        } else {
            System.out.println("查无此书！");
        }

    }
}
